<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: Vertx::Buffer
  
    &mdash; Ruby API Doc
  
</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  hasFrames = window.top.frames.main ? true : false;
  relpath = '../';
  framesUrl = "../frames.html#!" + escape(window.location.href);
</script>


  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>


  </head>
  <body>
    <div id="header">
      <div id="menu">
  
    <a href="../_index.html">Index (B)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../Vertx.html" title="Vertx (module)">Vertx</a></span></span>
     &raquo; 
    <span class="title">Buffer</span>
  

  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../class_list.html">
      Class List
    </a>
  
    <a class="full_list_link" id="method_list_link"
        href="../method_list.html">
      Method List
    </a>
  
    <a class="full_list_link" id="file_list_link"
        href="../file_list.html">
      File List
    </a>
  
</div>
      <div class="clear"></div>
    </div>

    <iframe id="search_frame"></iframe>

    <div id="content"><h1>Class: Vertx::Buffer
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">Vertx::Buffer</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
  
  
  
    <dt class="r2 last">Defined in:</dt>
    <dd class="r2 last">src/main/api_shim/core/buffer.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    A Buffer represents a sequence of zero or more bytes that can be written to or read from, and which expands
as necessary to accomodate any bytes written to it.

Buffers are used in many places in vert.x, for example to read/write data to/from <span class='object_link'><a href="NetSocket.html" title="Vertx::NetSocket (class)">NetSocket</a></span>, <span class='object_link'><a href="AsyncFile.html" title="Vertx::AsyncFile (class)">AsyncFile</a></span>,
<span class='object_link'><a href="WebSocket.html" title="Vertx::WebSocket (class)">WebSocket</a></span>, <span class='object_link'><a href="HttpClientRequest.html" title="Vertx::HttpClientRequest (class)">HttpClientRequest</a></span>, <span class='object_link'><a href="HttpClientResponse.html" title="Vertx::HttpClientResponse (class)">HttpClientResponse</a></span>, <span class='object_link'><a href="HttpServerRequest.html" title="Vertx::HttpServerRequest (class)">HttpServerRequest</a></span>, <span class='object_link'><a href="HttpServerResponse.html" title="Vertx::HttpServerResponse (class)">HttpServerResponse</a></span> etc.

There are two ways to write data to a Buffer: The first method involves methods that take the form set_XXX.
These methods write data into the buffer starting at the specified position. The position does not have to be inside data that
has already been written to the buffer; the buffer will automatically expand to encompass the position plus any data that needs
to be written. All positions are measured in bytes and start with zero.

The second method involves methods that take the form append-XXX; these methods append data at the end of the buffer.
Methods exist to both set and append all primitive types, String and  other instances of Buffer.

Data can be read from a buffer by invoking methods which take the form get_XXX. These methods take a parameter
representing the position in the Buffer from where to read data.

  </div>
</div>
<div class="tags">
  
<p class="tag_title">Author:</p>
<ul class="author">
  
    <li>
      
      
      
      
        
        <div class='inline'><a href="http://tfox.org" target="_parent" title="Tim Fox">Tim Fox</a></div>
      
    </li>
  
</ul>

</div>






  
    <h2>
      Class Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#create-class_method" title="create (class method)">+ (Object) <strong>create</strong>(initial_size_hint = 0) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Creates a new empty buffer.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#create_from_str-class_method" title="create_from_str (class method)">+ (Object) <strong>create_from_str</strong>(str, enc = &quot;UTF-8&quot;) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Create a new Buffer from a String.</div></span>
  
</li>

      
    </ul>
  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#append_buffer-instance_method" title="#append_buffer (instance method)">- (Buffer) <strong>append_buffer</strong>(buff) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Appends another buffer to the end of this buffer.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#append_fixnum-instance_method" title="#append_fixnum (instance method)">- (Buffer) <strong>append_fixnum</strong>(num, bytes) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Appends a FixNum to the end of this buffer.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#append_float-instance_method" title="#append_float (instance method)">- (Buffer) <strong>append_float</strong>(num, bytes) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Appends a Float to the end of this buffer.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#append_str-instance_method" title="#append_str (instance method)">- (Buffer) <strong>append_str</strong>(str, enc = &quot;UTF-8&quot;) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Appends a string to the end of this buffer.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#copy-instance_method" title="#copy (instance method)">- (Buffer) <strong>copy</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Get a copy of the entire buffer.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#get_buffer-instance_method" title="#get_buffer (instance method)">- (Buffer) <strong>get_buffer</strong>(pos, end_pos) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Return bytes in the buffer as a Buffer.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#get_byte-instance_method" title="#get_byte (instance method)">- (FixNum) <strong>get_byte</strong>(pos) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Get the byte at position pos in the buffer.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#get_fixnum-instance_method" title="#get_fixnum (instance method)">- (FixNum) <strong>get_fixnum</strong>(pos, bytes) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Get the FixNum represented by a sequence of bytes starting at position pos in the buffer.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#get_float-instance_method" title="#get_float (instance method)">- (Float) <strong>get_float</strong>(pos, bytes) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Get the Float represented by a sequence of bytes starting at position pos in the buffer.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#get_string-instance_method" title="#get_string (instance method)">- (String) <strong>get_string</strong>(pos, end_pos, enc = 'UTF-8') </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Return bytes from the buffer interpreted as a String.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#length-instance_method" title="#length (instance method)">- (FixNum) <strong>length</strong> </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>The length of this buffer, in bytes.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#set_buffer-instance_method" title="#set_buffer (instance method)">- (Buffer) <strong>set_buffer</strong>(pos, buff) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Sets bytes in this buffer to the bytes of the specified buffer.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#set_fixnum-instance_method" title="#set_fixnum (instance method)">- (Buffer) <strong>set_fixnum</strong>(pos, num, bytes) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Sets bytes in the buffer to a representation of a FixNum.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#set_float-instance_method" title="#set_float (instance method)">- (Buffer) <strong>set_float</strong>(pos, num, bytes) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Sets bytes in the buffer to a representation of a Float.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#set_string-instance_method" title="#set_string (instance method)">- (Buffer) <strong>set_string</strong>(pos, str, enc = 'UTF-8') </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Set bytes in the buffer to the string encoding in the specified encoding.</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#to_s-instance_method" title="#to_s (instance method)">- (String) <strong>to_s</strong>(enc = &quot;UTF-8&quot;) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>Return a String representation of the buffer.</div></span>
  
</li>

      
    </ul>
  



  <div id="class_method_details" class="method_details_list">
    <h2>Class Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="create-class_method">
  
    + (<tt>Object</tt>) <strong>create</strong>(initial_size_hint = 0) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Creates a new empty buffer. The <span class='object_link'><a href="#length-instance_method" title="Vertx::Buffer#length (method)">#length</a></span> of the buffer immediately after creation will be zero.
to initially allocate to the buffer to prevent excessive automatic re-allocations as data is written to it.

  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>initial_size_hint</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>0</tt>)</em>
      
      
        &mdash;
        <div class='inline'>is a hint to the system for how much memory</div>
      
    </li>
  
</ul>


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


47
48
49</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/buffer.rb', line 47</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_Buffer constant id'>Buffer</span><span class='dot token'>.</span><span class='rubyid_create identifier id'>create</span><span class='lparen token'>(</span><span class='rubyid_initial_size_hint identifier id'>initial_size_hint</span> <span class='assign token'>=</span> <span class='integer val'>0</span><span class='rparen token'>)</span>
  <span class='rubyid_Buffer constant id'>Buffer</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_org identifier id'>org</span><span class='dot token'>.</span><span class='rubyid_vertx identifier id'>vertx</span><span class='dot token'>.</span><span class='rubyid_java identifier id'>java</span><span class='dot token'>.</span><span class='rubyid_core identifier id'>core</span><span class='dot token'>.</span><span class='rubyid_buffer identifier id'>buffer</span><span class='dot token'>.</span><span class='rubyid_Buffer constant id'>Buffer</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_initial_size_hint identifier id'>initial_size_hint</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="create_from_str-class_method">
  
    + (<tt>Object</tt>) <strong>create_from_str</strong>(str, enc = &quot;UTF-8&quot;) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Create a new Buffer from a String

  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>str</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>The String to encode into the Buffer</div>
      
    </li>
  
    <li>
      
        <span class='name'>enc</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>&quot;UTF-8&quot;</tt>)</em>
      
      
        &mdash;
        <div class='inline'>Encoding to use. Defaults to &quot;UTF-8&quot;</div>
      
    </li>
  
</ul>


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


54
55
56</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/buffer.rb', line 54</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_Buffer constant id'>Buffer</span><span class='dot token'>.</span><span class='rubyid_create_from_str identifier id'>create_from_str</span><span class='lparen token'>(</span><span class='rubyid_str identifier id'>str</span><span class='comma token'>,</span> <span class='rubyid_enc identifier id'>enc</span> <span class='assign token'>=</span> <span class='string val'>&quot;UTF-8&quot;</span><span class='rparen token'>)</span>
  <span class='rubyid_Buffer constant id'>Buffer</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_org identifier id'>org</span><span class='dot token'>.</span><span class='rubyid_vertx identifier id'>vertx</span><span class='dot token'>.</span><span class='rubyid_java identifier id'>java</span><span class='dot token'>.</span><span class='rubyid_core identifier id'>core</span><span class='dot token'>.</span><span class='rubyid_buffer identifier id'>buffer</span><span class='dot token'>.</span><span class='rubyid_Buffer constant id'>Buffer</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_str identifier id'>str</span><span class='comma token'>,</span> <span class='rubyid_enc identifier id'>enc</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="append_buffer-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>) <strong>append_buffer</strong>(buff) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Appends another buffer to the end of this buffer. The buffer will expand as necessary to accomodate any bytes
written.

  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>buff</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>the buffer to append.</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>a reference to self so multiple operations can be appended together.</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


128
129
130
131</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/buffer.rb', line 128</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_append_buffer identifier id'>append_buffer</span><span class='lparen token'>(</span><span class='rubyid_buff identifier id'>buff</span><span class='rparen token'>)</span>
  <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_appendBuffer identifier id'>appendBuffer</span><span class='lparen token'>(</span><span class='rubyid_buff identifier id'>buff</span><span class='dot token'>.</span><span class='rubyid__to_java_buffer identifier id'>_to_java_buffer</span><span class='rparen token'>)</span>
  <span class='rubyid_self self kw'>self</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="append_fixnum-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>) <strong>append_fixnum</strong>(num, bytes) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Appends a FixNum to the end of this buffer. The buffer will expand as necessary to accomodate any bytes written.

  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>num</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>the fixnum to append.</div>
      
    </li>
  
    <li>
      
        <span class='name'>bytes</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>the number of bytes to write in the buffer to represent the fixnum. Valid values are 1, 2, 4 and 8.</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>a reference to self so multiple operations can be appended together.</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


137
138
139
140
141
142
143
144
145
146
147
148
149
150
151</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/buffer.rb', line 137</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_append_fixnum identifier id'>append_fixnum</span><span class='lparen token'>(</span><span class='rubyid_num identifier id'>num</span><span class='comma token'>,</span> <span class='rubyid_bytes identifier id'>bytes</span><span class='rparen token'>)</span>
  <span class='rubyid_case case kw'>case</span> <span class='rubyid_bytes identifier id'>bytes</span>
    <span class='rubyid_when when kw'>when</span> <span class='integer val'>1</span>
      <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_appendByte identifier id'>appendByte</span><span class='lparen token'>(</span><span class='rubyid_num identifier id'>num</span><span class='rparen token'>)</span>
    <span class='rubyid_when when kw'>when</span> <span class='integer val'>2</span>
      <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_appendShort identifier id'>appendShort</span><span class='lparen token'>(</span><span class='rubyid_num identifier id'>num</span><span class='rparen token'>)</span>
    <span class='rubyid_when when kw'>when</span> <span class='integer val'>4</span>
      <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_appendInt identifier id'>appendInt</span><span class='lparen token'>(</span><span class='rubyid_num identifier id'>num</span><span class='rparen token'>)</span>
    <span class='rubyid_when when kw'>when</span> <span class='integer val'>8</span>
      <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_appendLong identifier id'>appendLong</span><span class='lparen token'>(</span><span class='rubyid_num identifier id'>num</span><span class='rparen token'>)</span>
    <span class='rubyid_else else kw'>else</span>
      <span class='rubyid_raise identifier id'>raise</span> <span class='string val'>&quot;bytes must be 1, 2, 4, or 8&quot;</span>
  <span class='rubyid_end end kw'>end</span>
  <span class='rubyid_self self kw'>self</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="append_float-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>) <strong>append_float</strong>(num, bytes) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Appends a Float to the end of this buffer. The buffer will expand as necessary to accomodate any bytes written.

  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>num</span>
      
      
        <span class='type'>(<tt>Float</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>the float to append.</div>
      
    </li>
  
    <li>
      
        <span class='name'>bytes</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>the number of bytes to write in the buffer to represent the float. Valid values are 4 and 8.</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>a reference to self so multiple operations can be appended together.</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


157
158
159
160
161
162
163
164
165
166</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/buffer.rb', line 157</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_append_float identifier id'>append_float</span><span class='lparen token'>(</span><span class='rubyid_num identifier id'>num</span><span class='comma token'>,</span> <span class='rubyid_bytes identifier id'>bytes</span><span class='rparen token'>)</span>
  <span class='rubyid_case case kw'>case</span> <span class='rubyid_bytes identifier id'>bytes</span>
    <span class='rubyid_when when kw'>when</span> <span class='integer val'>4</span>
      <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_appendFloat identifier id'>appendFloat</span><span class='lparen token'>(</span><span class='rubyid_num identifier id'>num</span><span class='rparen token'>)</span>
    <span class='rubyid_when when kw'>when</span> <span class='integer val'>8</span>
      <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_appendDouble identifier id'>appendDouble</span><span class='lparen token'>(</span><span class='rubyid_num identifier id'>num</span><span class='rparen token'>)</span>
    <span class='rubyid_else else kw'>else</span>
      <span class='rubyid_raise identifier id'>raise</span> <span class='string val'>&quot;bytes must be 4 or 8&quot;</span>
  <span class='rubyid_end end kw'>end</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="append_str-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>) <strong>append_str</strong>(str, enc = &quot;UTF-8&quot;) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Appends a string to the end of this buffer. The buffer will expand as necessary to accomodate any bytes written.

  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>str</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>the string to append.</div>
      
    </li>
  
    <li>
      
        <span class='name'>enc</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>&quot;UTF-8&quot;</tt>)</em>
      
      
        &mdash;
        <div class='inline'>the encoding to use. Defaults to &quot;UTF-8&quot;</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>a reference to self so multiple operations can be appended together.</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


172
173
174
175</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/buffer.rb', line 172</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_append_str identifier id'>append_str</span><span class='lparen token'>(</span><span class='rubyid_str identifier id'>str</span><span class='comma token'>,</span> <span class='rubyid_enc identifier id'>enc</span> <span class='assign token'>=</span> <span class='string val'>&quot;UTF-8&quot;</span><span class='rparen token'>)</span>
  <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_appendString identifier id'>appendString</span><span class='lparen token'>(</span><span class='rubyid_str identifier id'>str</span><span class='comma token'>,</span> <span class='rubyid_enc identifier id'>enc</span><span class='rparen token'>)</span>
  <span class='rubyid_self self kw'>self</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="copy-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>) <strong>copy</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Get a copy of the entire buffer.

  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>the copy</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


241
242
243</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/buffer.rb', line 241</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_copy identifier id'>copy</span>
  <span class='rubyid_Buffer constant id'>Buffer</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_copy identifier id'>copy</span><span class='lparen token'>(</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="get_buffer-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>) <strong>get_buffer</strong>(pos, end_pos) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Return bytes in the buffer as a Buffer

  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>start_pos</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>- the position in this buffer from where to start the copy.</div>
      
    </li>
  
    <li>
      
        <span class='name'>end_pos</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>- the copy will be made up to index end_pos - 1</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>the copy</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


119
120
121
122</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/buffer.rb', line 119</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_get_buffer identifier id'>get_buffer</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='comma token'>,</span> <span class='rubyid_end_pos identifier id'>end_pos</span><span class='rparen token'>)</span>
  <span class='rubyid_j_buff identifier id'>j_buff</span> <span class='assign token'>=</span> <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_getBuffer identifier id'>getBuffer</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='comma token'>,</span> <span class='rubyid_end_pos identifier id'>end_pos</span><span class='rparen token'>)</span>
  <span class='rubyid_Buffer constant id'>Buffer</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_j_buff identifier id'>j_buff</span><span class='rparen token'>)</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="get_byte-instance_method">
  
    - (<tt>FixNum</tt>) <strong>get_byte</strong>(pos) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Get the byte at position pos in the buffer.

  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>pos</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>the position in the buffer from where to retrieve the byte</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>the byte</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


68
69
70</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/buffer.rb', line 68</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_get_byte identifier id'>get_byte</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='rparen token'>)</span>
  <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_getByte identifier id'>getByte</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='rparen token'>)</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="get_fixnum-instance_method">
  
    - (<tt>FixNum</tt>) <strong>get_fixnum</strong>(pos, bytes) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Get the FixNum represented by a sequence of bytes starting at position pos in the buffer.

  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>pos</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>the position in the buffer from where to retrieve the FixNum.</div>
      
    </li>
  
    <li>
      
        <span class='name'>bytes</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>the number of bytes to retrieve from position pos to create the FixNum. Valid values are 1, 2, 4 and 8.</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>the FixNum</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


76
77
78
79
80
81
82
83
84
85
86
87
88
89</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/buffer.rb', line 76</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_get_fixnum identifier id'>get_fixnum</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='comma token'>,</span> <span class='rubyid_bytes identifier id'>bytes</span><span class='rparen token'>)</span>
  <span class='rubyid_case case kw'>case</span> <span class='rubyid_bytes identifier id'>bytes</span>
    <span class='rubyid_when when kw'>when</span> <span class='integer val'>1</span>
      <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_getByte identifier id'>getByte</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='rparen token'>)</span>
    <span class='rubyid_when when kw'>when</span> <span class='integer val'>2</span>
      <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_getShort identifier id'>getShort</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='rparen token'>)</span>
    <span class='rubyid_when when kw'>when</span> <span class='integer val'>4</span>
      <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_getInt identifier id'>getInt</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='rparen token'>)</span>
    <span class='rubyid_when when kw'>when</span> <span class='integer val'>8</span>
      <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_getLong identifier id'>getLong</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='rparen token'>)</span>
    <span class='rubyid_else else kw'>else</span>
      <span class='rubyid_raise identifier id'>raise</span> <span class='string val'>&quot;bytes must be 1, 2, 4, or 8&quot;</span>
  <span class='rubyid_end end kw'>end</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="get_float-instance_method">
  
    - (<tt>Float</tt>) <strong>get_float</strong>(pos, bytes) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Get the Float represented by a sequence of bytes starting at position pos in the buffer.

  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>pos</span>
      
      
        <span class='type'>(<tt>Float</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>the position in the buffer from where to retrieve the Float.</div>
      
    </li>
  
    <li>
      
        <span class='name'>bytes</span>
      
      
        <span class='type'>(<tt>Float</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>the number of bytes to retrieve from position pos to create the Float. Valid values are 4 and 8.</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Float</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>the Float</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


95
96
97
98
99
100
101
102
103
104</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/buffer.rb', line 95</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_get_float identifier id'>get_float</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='comma token'>,</span> <span class='rubyid_bytes identifier id'>bytes</span><span class='rparen token'>)</span>
  <span class='rubyid_case case kw'>case</span> <span class='rubyid_bytes identifier id'>bytes</span>
    <span class='rubyid_when when kw'>when</span> <span class='integer val'>4</span>
      <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_getFloat identifier id'>getFloat</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='rparen token'>)</span>
    <span class='rubyid_when when kw'>when</span> <span class='integer val'>8</span>
      <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_getDouble identifier id'>getDouble</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='rparen token'>)</span>
    <span class='rubyid_else else kw'>else</span>
      <span class='rubyid_raise identifier id'>raise</span> <span class='string val'>&quot;bytes must be 4 or 8&quot;</span>
  <span class='rubyid_end end kw'>end</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="get_string-instance_method">
  
    - (<tt>String</tt>) <strong>get_string</strong>(pos, end_pos, enc = 'UTF-8') 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Return bytes from the buffer interpreted as a String

  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>pos</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>the position in the buffer from where to start reading</div>
      
    </li>
  
    <li>
      
        <span class='name'>end_pos</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>the position in the buffer to end reading</div>
      
    </li>
  
    <li>
      
        <span class='name'>enc</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>'UTF-8'</tt>)</em>
      
      
        &mdash;
        <div class='inline'>The encoding to use</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>the String</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


111
112
113</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/buffer.rb', line 111</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_get_string identifier id'>get_string</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='comma token'>,</span> <span class='rubyid_end_pos identifier id'>end_pos</span><span class='comma token'>,</span> <span class='rubyid_enc identifier id'>enc</span> <span class='assign token'>=</span> <span class='string val'>'UTF-8'</span><span class='rparen token'>)</span>
  <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_getString identifier id'>getString</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='comma token'>,</span> <span class='rubyid_end_pos identifier id'>end_pos</span><span class='comma token'>,</span> <span class='rubyid_enc identifier id'>enc</span><span class='rparen token'>)</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="length-instance_method">
  
    - (<tt>FixNum</tt>) <strong>length</strong> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    The length of this buffer, in bytes.

  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>the length of this buffer, in bytes.</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


235
236
237</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/buffer.rb', line 235</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_length identifier id'>length</span>
  <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_length identifier id'>length</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="set_buffer-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>) <strong>set_buffer</strong>(pos, buff) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Sets bytes in this buffer to the bytes of the specified buffer. The buffer will expand as necessary to accomodate any bytes written.

  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>pos</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>- the position in this buffer from where to start writing the buffer</div>
      
    </li>
  
    <li>
      
        <span class='name'>buff</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>- the buffer to write into this buffer</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>a reference to self so multiple operations can be appended together.</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


219
220
221
222</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/buffer.rb', line 219</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_set_buffer identifier id'>set_buffer</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='comma token'>,</span> <span class='rubyid_buff identifier id'>buff</span><span class='rparen token'>)</span>
  <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_setBytes identifier id'>setBytes</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='comma token'>,</span> <span class='rubyid_buff identifier id'>buff</span><span class='dot token'>.</span><span class='rubyid__to_java_buffer identifier id'>_to_java_buffer</span><span class='rparen token'>)</span>
  <span class='rubyid_self self kw'>self</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="set_fixnum-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>) <strong>set_fixnum</strong>(pos, num, bytes) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Sets bytes in the buffer to a representation of a FixNum. The buffer will expand as necessary to accomodate any bytes written.

  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>pos</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>- the position in the buffer from where to start writing the FixNum</div>
      
    </li>
  
    <li>
      
        <span class='name'>num</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>- the FixNum to write</div>
      
    </li>
  
    <li>
      
        <span class='name'>bytes</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>- the number of bytes to write to represent the FixNum. Valid values are 1, 2, 4, and 8</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>a reference to self so multiple operations can be appended together.</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


182
183
184
185
186
187
188
189
190
191
192
193
194
195
196</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/buffer.rb', line 182</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_set_fixnum identifier id'>set_fixnum</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='comma token'>,</span> <span class='rubyid_num identifier id'>num</span><span class='comma token'>,</span> <span class='rubyid_bytes identifier id'>bytes</span><span class='rparen token'>)</span>
  <span class='rubyid_case case kw'>case</span> <span class='rubyid_bytes identifier id'>bytes</span>
    <span class='rubyid_when when kw'>when</span> <span class='integer val'>1</span>
      <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_setByte identifier id'>setByte</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='comma token'>,</span> <span class='rubyid_num identifier id'>num</span><span class='rparen token'>)</span>
    <span class='rubyid_when when kw'>when</span> <span class='integer val'>2</span>
      <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_setShort identifier id'>setShort</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='comma token'>,</span> <span class='rubyid_num identifier id'>num</span><span class='rparen token'>)</span>
    <span class='rubyid_when when kw'>when</span> <span class='integer val'>4</span>
      <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_setInt identifier id'>setInt</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='comma token'>,</span> <span class='rubyid_num identifier id'>num</span><span class='rparen token'>)</span>
    <span class='rubyid_when when kw'>when</span> <span class='integer val'>8</span>
      <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_setLong identifier id'>setLong</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='comma token'>,</span> <span class='rubyid_num identifier id'>num</span><span class='rparen token'>)</span>
    <span class='rubyid_else else kw'>else</span>
      <span class='rubyid_raise identifier id'>raise</span> <span class='string val'>&quot;bytes must be 1, 2, 4, or 8&quot;</span>
  <span class='rubyid_end end kw'>end</span>
  <span class='rubyid_self self kw'>self</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="set_float-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>) <strong>set_float</strong>(pos, num, bytes) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Sets bytes in the buffer to a representation of a Float. The buffer will expand as necessary to accomodate any bytes written.

  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>pos</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>- the position in the buffer from where to start writing the Float</div>
      
    </li>
  
    <li>
      
        <span class='name'>num</span>
      
      
        <span class='type'>(<tt>Float</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>- the Float to write</div>
      
    </li>
  
    <li>
      
        <span class='name'>bytes</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>- the number of bytes to write to represent the Float. Valid values are 4 and 8</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>a reference to self so multiple operations can be appended together.</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


203
204
205
206
207
208
209
210
211
212
213</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/buffer.rb', line 203</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_set_float identifier id'>set_float</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='comma token'>,</span> <span class='rubyid_num identifier id'>num</span><span class='comma token'>,</span> <span class='rubyid_bytes identifier id'>bytes</span><span class='rparen token'>)</span>
  <span class='rubyid_case case kw'>case</span> <span class='rubyid_bytes identifier id'>bytes</span>
    <span class='rubyid_when when kw'>when</span> <span class='integer val'>4</span>
      <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_setFloat identifier id'>setFloat</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='comma token'>,</span> <span class='rubyid_num identifier id'>num</span><span class='rparen token'>)</span>
    <span class='rubyid_when when kw'>when</span> <span class='integer val'>8</span>
      <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_setDouble identifier id'>setDouble</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='comma token'>,</span> <span class='rubyid_num identifier id'>num</span><span class='rparen token'>)</span>
    <span class='rubyid_else else kw'>else</span>
      <span class='rubyid_raise identifier id'>raise</span> <span class='string val'>&quot;bytes must be 4 or 8&quot;</span>
  <span class='rubyid_end end kw'>end</span>
  <span class='rubyid_self self kw'>self</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="set_string-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>) <strong>set_string</strong>(pos, str, enc = 'UTF-8') 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Set bytes in the buffer to the string encoding in the specified encoding

  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>pos</span>
      
      
        <span class='type'>(<tt>FixNum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>- the position in this buffer from where to start writing the string</div>
      
    </li>
  
    <li>
      
        <span class='name'>str</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>the string</div>
      
    </li>
  
    <li>
      
        <span class='name'>enc</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>'UTF-8'</tt>)</em>
      
      
        &mdash;
        <div class='inline'>the encoding</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="" title="Vertx::Buffer (class)">Buffer</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>a reference to self so multiple operations can be appended together.</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


229
230
231
232</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/buffer.rb', line 229</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_set_string identifier id'>set_string</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='comma token'>,</span> <span class='rubyid_str identifier id'>str</span><span class='comma token'>,</span> <span class='rubyid_enc identifier id'>enc</span> <span class='assign token'>=</span> <span class='string val'>'UTF-8'</span><span class='rparen token'>)</span>
  <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_setString identifier id'>setString</span><span class='lparen token'>(</span><span class='rubyid_pos identifier id'>pos</span><span class='comma token'>,</span> <span class='rubyid_str identifier id'>str</span><span class='comma token'>,</span> <span class='rubyid_enc identifier id'>enc</span><span class='rparen token'>)</span>
  <span class='rubyid_self self kw'>self</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="to_s-instance_method">
  
    - (<tt>String</tt>) <strong>to_s</strong>(enc = &quot;UTF-8&quot;) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    Return a String representation of the buffer.

  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>enc</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>&quot;UTF-8&quot;</tt>)</em>
      
      
        &mdash;
        <div class='inline'>The encoding to use. Defaults to &quot;UTF-8&quot;</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>a String representation of the buffer.</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


61
62
63</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'src/main/api_shim/core/buffer.rb', line 61</span>

<span class='rubyid_def def kw'>def</span> <span class='rubyid_to_s identifier id'>to_s</span><span class='lparen token'>(</span><span class='rubyid_enc identifier id'>enc</span> <span class='assign token'>=</span> <span class='string val'>&quot;UTF-8&quot;</span><span class='rparen token'>)</span>
  <span class='rubyid_@buffer ivar id'>@buffer</span><span class='dot token'>.</span><span class='rubyid_toString identifier id'>toString</span><span class='lparen token'>(</span><span class='rubyid_enc identifier id'>enc</span><span class='rparen token'>)</span>
<span class='rubyid_end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

    <div id="footer">
  Generated on Wed Jul 17 20:30:37 2013 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.6.1 (ruby-1.9.3).
</div>

  </body>
</html>